function P=s_random(G,P,k)
% s_random: An example subroutine to step a player with the so-called "random motion"
%
% SYNTAX:
%   P = s_random(G,P,k)
%   Return the player object with updated position (P.pos) ,angle (P.ang) and states (P.Vars).
%   Magnitudes of random increments of P.pos and P.ang are determined by P.speed and P.ang_speed, respectively.

%   Author: Hongbin Ma
%   Last updated: 2009-6-2 with MATLAB 6.5
%   Problems or suggestions? Email me: mathmhb[at]163.com

P.pos=P.pos+(rand(1,length(P.pos))-0.5)*P.speed*G.h;
P.ang=P.ang+(rand(1,length(P.ang))-0.5)*P.ang_speed*G.h;
P=feval(P.calc_Vars_func,G,P,k);
